<?php
	namespace Mall\Model;
	use Common\Model\BaseModel;
	class YimeiActivityModel extends BaseModel{


		public $_scope = [
			['valid'=>[
				'where'=>['is_closed'=>0,'delete_at'=>0]]
			],
		];

		protected function _after_find(&$record,$option){
			if($record['thumb']){
				$record['thumb'] = explode(",", $record['thumb']);
			}else{
				$record['thumb'] = [];
			}

			if($record['pc_thumb']){
				$record['pc_thumb'] = explode(",", $record['pc_thumb']);
			}else{
				$record['pc_thumb'] = [];
			}

		}

		protected function _after_select(&$records,$option){
			
			foreach($records as &$record){
				if($record['thumb']){
					$record['thumb'] = explode(",", $record['thumb']);	
				}else{
					$record['thumb'] = [];
				} 
				if($record['pc_thumb']){
					$record['pc_thumb'] = explode(",", $record['pc_thumb']);	
				}else{
					$record['pc_thumb'] = [];
				}
			}
		}
	}